// 编辑用户
$(function () {
  var form = layui.form
  let id = new URLSearchParams(location.search).get('id')
  
  function num() {
    $.ajax({
      type:'get',
      url:'/admin/users/' + id,
      success:function (res) {
        console.log(res);
        if(res.status === 0){
        form.val('editForm', res.data)
      } else {
        layer.msg(res.message)
      }
    }
  })
  }

num()
layui-form
// 绑定添加用户表单提交事件
$('.layui-form').on('submit',function (e) {
e.preventDefault()
let fd = $('.layui-form').serialize()
// console.log(fd);
$.ajax({
    type: 'PUT',
    url: '/admin/users',
    data: fd,
    success: function (res) {
      layer.msg(res.message)
    }
 })
})
})